﻿using System;
using System.Collections.Generic;
using System.Text;
using CartoLab.GeometryLib.Geometries;
using System.Drawing;

namespace CartoLab.ShortestPath
{
    public class Edge
    {
        public Edge(string id, string startNodeId, 
                    string endNodeId, double weight)
        {
            this.ID = id;
            this._startNodeID = startNodeId;
            this._endNodeID = endNodeId;
            this.Weight = weight;
        }

        private string _id = "";

        public string ID
        {
            get { return _id; }
            set { _id = value; }
        }


        private string _startNodeID;

        public string StartNodeID
        {
            get { return _startNodeID; }
            set { _startNodeID = value; }
        }
        private string _endNodeID;

        public string EndNodeID
        {
            get { return _endNodeID; }
            set { _endNodeID = value; }
        }
        private double _weight;

    
        /// <summary>
        /// 权值，代价  
        /// </summary>
        public double Weight
        {
            get { return _weight; }
            set { _weight = value; }
        }

        private Node _startNode = null;

        public Node StartNode
        {
            get { return _startNode; }
            set { _startNode = value; }
        }
        private Node _endNode = null;

        public Node EndNode
        {
            get { return _endNode; }
            set { _endNode = value; }
        }

        internal void Render(Graphics g)
        {
            PointF pfStart = new PointF((float)this.StartNode.Postition.X,
                                        (float)this.StartNode.Postition.Y);

            PointF pfEnd = new PointF((float)this.EndNode.Postition.X,
                                       (float)this.EndNode.Postition.Y);

            g.DrawLine(Pens.DeepPink, pfStart, pfEnd);
            //g.DrawLine(Pens.Gray, pfStart, pfEnd);
        }
    }
}
